package galaxies.sectors;

import java.util.ArrayList;

import controller.IController;
import utilities.Key;
import view.AbstractView;
import view.IView;
import model.IModel;
import model.AbstractModel;

/*
 * Holds keys to tiles within, used to present area view of sector in main screen.
 * 
 * MSectors are astro-graphical boundaries that provide a sense of location for groups of stars.
 */
public class SectorModel extends AbstractModel {
	
	private ArrayList<ArrayList<Integer>> locations = new ArrayList<ArrayList<Integer>>(); //all tiles contained in this sector
	private int numLocations;
	private double area = 0.0;
		
	private int numStars; //starting number of stars in this sector
	
	private String name;
	
	public SectorModel(String name, ArrayList<ArrayList<Integer>> locations) {
		this.name = name;
		this.locations.addAll(locations);
		this.numLocations = locations.size();
		calcArea();
	}
	
	public void setNumStars(int numStars) {
		this.numStars = numStars;
	}
	
	public int getNumStars() {
		return this.numStars;		
	}
	
	public double getArea() {
		return this.area;
	}
	
	private void calcArea() {
		//http://en.wikipedia.org/wiki/Hexagon
		this.area = 3*Math.sqrt(3)/(2*3)*numLocations;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
}
